import type { Coordinate } from 'ol/coordinate'
import type { Extent } from 'ol/extent'
import type { ProjectionLike } from 'ol/proj'

/**
 * @param center 地图中心
 * @param constrainRotation 旋转约束，defaults to true, For example, 4 will constrain the rotation to 0, 90, 180, and 270 degrees
 * @param enableRotation 开启旋转, defaults to true，false 则constrainRotation不生效
 * @param extent 范围，[minx, miny, maxx, maxy]，视野范围
 * @param constrainOnlyCenter defaults to false, 如果为true，则范围约束将仅应用于视图中心，而不是整个范围。
 * @param smoothExtentConstraint 平滑应用地图范围，defaults to true，范围约束将平滑地应用，即允许视图稍微超出给定范围。
 * @param maxResolution 分辨率约束的最大分辨率，优先于mixZoom
 * @param minResolution 分辨率约束的最小分辨率，优先于maxZoom
 * @param maxZoom 最大缩放级别，defaults to 28
 * @param mixZoom 最小缩放级别，defaults to 0
 * @param multiWorld defaults to false
 * @param constrainResolution defaults to false,为true，视图将在交互后始终动画到最接近的缩放级别;False表示允许中间缩放级别。
 * @param smoothResolutionConstraint defaults to true, 分辨率最小/最大值将平滑地应用，即允许视图稍微超过给定的分辨率或缩放界限。
 * @param showFullExtent defaults to false, Allow the view to be zoomed out to show the full configured extent. By default, when a view is configured with an extent, users will not be able to zoom out so the viewport exceeds the extent in either dimension. This means the full extent may not be visible if the viewport is taller or wider than the aspect ratio of the configured extent. If showFullExtent is true, the user will be able to zoom out so that the viewport exceeds the height or width of the configured extent, but not both, allowing the full extent to be shown.
 * @param projection 坐标系，defaults to 'EPSG:3857'
 * @param resolution 视图的初始分辨率 单位是每像素的投影单位(如米每像素)。另一种设置方法是设置缩放。如果既没有定义this也没有定义zoom，则不会获取图层源，但稍后可以使用#setZoom或#setResolution设置它们
 * @param resolutions 如果指定，确定缩放级别的分辨率。数组中的索引对应于缩放级别，因此分辨率值必须按降序排列。它还通过最小值和最大值来约束分辨率。如果设置了maxResolution，则忽略minResolution, minZoom, maxZoom和zoomFactor选项。
 * @param rotation defaults to 0, 以弧度为单位的视图初始旋转(顺时针正旋转，0表示向北)。
 * @param zoom 仅在未定义resolution时使用。用于计算视图的初始分辨率的缩放级别。
 * @param zoomFactor defaults to 2，用于计算相应分辨率的缩放系数。
 * @param padding defaults to [0, 0, 0, 0]
 * @param target 节点id
 */
// extends View
export interface MapOption {
  center?: Coordinate | undefined
  constrainRotation?: boolean | number
  enableRotation?: boolean
  extent?: Extent | undefined
  constrainOnlyCenter?: boolean
  smoothExtentConstraint?: boolean
  maxResolution?: number | undefined
  minResolution?: number | undefined
  maxZoom?: number
  minZoom?: number
  multiWorld?: boolean
  constrainResolution?: boolean
  smoothResolutionConstraint?: boolean
  showFullExtent?: boolean
  projection?: ProjectionLike
  resolution?: number | undefined
  resolutions?: Array<number> | undefined
  rotation?: number
  zoom?: number | undefined
  zoomFactor?: number
  padding?: Array<number>
  target?: string
}

export type DrawType =
  | 'Point'
  | 'LineString'
  | 'LinearRing'
  | 'Polygon'
  | 'MultiPoint'
  | 'MultiLineString'
  | 'MultiPolygon'
  | 'GeometryCollection'
  | 'Circle'
